#pragma GCC optimize(2)
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <map>
#include <unordered_map>
#include <vector>
#include <set>
#include <queue>

using namespace std;
using LL = long long;
using PII = pair<int, int>;

const int N = 110;

int n, k;
int A[N];


int main(){
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    cin >> n >> k;
    for(int i = 1; i <= n; i ++) cin >> A[i];


 //   cout << n << " " << k << '\n';
    if(k > n){
        for(int i = 1; i <= n; i ++) cout << 0 << " ";
    }else{
        for(int i = k + 1; i <= n; i ++){
            cout << A[i] << " ";
        }

        for(int i = 1; i <= k; i ++) cout << 0 << " ";
    }


    return 0;
}